{% extends 'layout/default.html.twig' %}

{% block title %}Blog{% endblock %}

{% block meta %}
    <meta name="description" content="Blog Page description" />
{% endblock %}

{% block breadcrumbs %}
    <ul class="breadcrumb">
        <li class="breadcrumb-item"><a href="{{ path('home') }}">Home</a></li>
        <li class="breadcrumb-item active">Blog</li>
    </ul>
{% endblock %}

{% block content %}
    <h1>Blog</h1>

    {% for post in posts %}

        <div class="card mb-3">
            <div class="card-header">
                <span class="float-right">{{ post.date|date('Y-m-d') }}, {{ post.commentsCount }} comments</span>
                <a href="{{ path('blog_show', {'id': post.id}) }}">{{ post.title }}</a>
            </div>
            <div class="card-body">{{ post.preview|nl2br }}</div>
        </div>

    {% endfor %}

    {% include 'share/pager.html.twig' with {
        'pager': pager,
        'main_route': 'blog',
        'route': 'blog_page',
    } %}

{% endblock %}
